package cn.edu.baiyunu.myapplication

import android.app.Application
import cn.edu.baiyunu.myapplication.data.db.AppDatabase
import cn.edu.baiyunu.myapplication.data.repository.PhotoRepository
import cn.edu.baiyunu.myapplication.data.repository.PhotoRepositoryImpl
import cn.edu.baiyunu.myapplication.data.repository.PreferenceRepository
import cn.edu.baiyunu.myapplication.data.repository.PreferenceRepositoryImpl

/**
 * 应用入口类
 */
class PhotoIdApplication : Application() {
    
    // 数据库实例
    private val database by lazy { AppDatabase.getDatabase(this) }
    
    // 仓库实例
    val photoRepository: PhotoRepository by lazy {
        PhotoRepositoryImpl(database.photoRecordDao())
    }
    
    val preferenceRepository: PreferenceRepository by lazy {
        PreferenceRepositoryImpl(database.userPreferenceDao())
    }
} 